finding the nth partial sum